<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-8-12
 * Time: 下午3:45
 */

header("Content-type: text/html; charset=utf-8");
//判断数据库连接
if (!class_exists("go_sql")) {
    include("/var/www/html/new/conf/le.je");
    $le = new go_sql();
    $le->connect();
}
$ac = '16ucom';
$pw = 'c33367701511b4f6020ec61ded352059';
$inSide = new SoapClient(null, array("location" => "http://localhost/open/openService/pft_insideMX.php", "uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
$order_true = 1997019; //票付通订单号
$pft_order = $inSide->Order_Globle_Search(
    0, 0, 0, 0, "",
    "", "", "", "", "",
    "", "", $order_true, "", 0,
    "", "", "", 1, 0,
    0, 1, "", "", "",
    "", "", "", "", "",
    "", "", "1", "", "");
$pft_order_xml = simplexml_load_string($pft_order);
$UUlid = (int)$pft_order_xml->Rec->UUlid; //景区id
$UUtid = (int)$pft_order_xml->Rec->UUtid; //门票id
$UUltitle = (string)$pft_order_xml->Rec->UUltitle; //景区名称
$UUttitle = (string)$pft_order_xml->Rec->UUttitle; //门票名称
$ordername = (string)$pft_order_xml->Rec->UUordername; //订单客人姓名
$UUtnum = (int)$pft_order_xml->Rec->UUtnum; //订单数量
$UUremotenums = explode("_", (string)$pft_order_xml->Rec->UUremotenum);
$UUremotenum = $UUremotenums[1]; //远端订单号
$UUpid = (int)$pft_order_xml->Rec->UUpid; //门票pid
$UUordertime = (string)$pft_order_xml->Rec->UUordertime; //下单时间
$UUplaytime = (string)$pft_order_xml->Rec->UUbegintime; //游玩时间
$UUendtime = (string)$pft_order_xml->Rec->UUendtime; //结束时间
$UUtprice = (string)$pft_order_xml->Rec->UUtprice; //结算价
$UUordertel = (string)$pft_order_xml->Rec->UUordertel; //订单客人手机号码
$UUstatus = (int)$pft_order_xml->Rec->UUstatus; //订单状态
$IDcar = (string)$pft_order_xml->Rec->UUpersonid; //订单客人身份证号
$UUcode = (string)$pft_order_xml->Rec->UUcode; //凭证码
$UUqrcodeIMG=(string)$pft_order_xml->Rec->UUqrcodeIMG; //二维码图片
$UUdname=(string)$pft_order_xml->Rec->UUdname; //供应商-预订网站
$UUtotalmoney = (string)$pft_order_xml->Rec->UUtotalmoney; //供应商-预订网站
$UUsellid = (string)$pft_order_xml->Rec->UUsellid; //分销商
$UUplaytime = date('Ymd',strtotime($UUplaytime));
$UUendtime = date('Ymd',strtotime($UUendtime));
$select_uuid = "select uuid from uu_jq_ticket where id=" . $UUtid . " limit 1";
$GLOBALS['le']->query($select_uuid);
$GLOBALS['le']->fetch_assoc();
$uuid = $GLOBALS['le']->f('uuid'); //查询商品编码id

$UUlprice = $inSide->get_Dynamic_Price_Merge(
    $UUpid, $UUplaytime, 1, '', '', 1, 0
); //零售价

$retime2 = microtime(true);
$pay_status = $orders['pay_status']; //0未支付，1已支付

$request_array = array(
    'pftordernum' =>$order_true,
    'pftordername' =>$ordername,
    'UUtnum' =>$UUtnum,
    'UUordertime'=>$UUordertime,
    'UUplaytime'=>$UUplaytime,
    'UUendtime'=>$UUendtime,
    'UUdname'=>$UUdname,
    'UUtprice'=>$UUtprice / 100,
    'UUordertel'=>$UUordertel,
    'UUtotalmoney'=>$UUtotalmoney,
    'uuid'=>$uuid,
    'IDcar'=>$IDcar,
    'productname'=>$UUttitle,
    'UUltitle'=>$UUltitle,
    'UUcode'=>$UUcode,
    'UUlprice'=>$UUlprice / 100,
    'ispay' => $pay_status,
    'gprice'=> $gprice,
    'tprice'=> $tprice,
);


switch ($UUlid) {
    case 10980://百合
        include_once '/var/www/html/new/d/module/qkxproject/api/shenyouhuaxia/syhx.class.php';
        $syhx = new ShenYouHuaXia($UUlid);
        $request = $syhx->submitOrder($request_array);

        if($request == 101){
            echo 101;
        }
        else{
            echo 100;
        }
        break;

    default:
    break;
}